<?php
class UserModel extends AppModel {

	var $name = 'user';
	public $table = 'user';
	public $primaryKey = 'id';	
 	var $validate = array('username' => array('between' => array('rule' => array('between', 5, 20), 'message' => '用户名为5-20个字符.')),
						  'password1' => array('between' => array('rule' => array('between', 5, 20), 'message' => '密码为5-20个字符.')),
						  'ckpassword' => array('rule' => array('validateConfirmPassword'),'message'=>'两次输入的密码不同.'),
/*						  'passwd2' => array('rule' => array('validateConfirmPasswordForChangePasswd'),'message'=>'Passwords you entered are not the same.'),*/
						  'email' => array('rule' => 'email', 'allowEmpty' => true, 'message' => 'Invalid Email Address.'), 
					);
	var $importOldData = false;
	
/*     var $hasOne = array('shopusermsg'=>array('className' => 'shopusermsg','foreignKey' => 'userid','dependent' => true,'exclusive' => true));	 */
	
	function validateConfirmPassword($data) {
		if ($this->data['user']['password1'] == $this->data['user']['ckpassword']) {
			return true;
		}
		return false;
	}	

	
}
?>